package com.realshare.bby.service.integral;

import com.realshare.frame.component.quartz.base.AutoScheduler;
import com.realshare.frame.component.quartz.base.BaseScheduler;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ${DESCRIPTION}
 * author leisure
 * email 15075107120@139.com
 * create 2018-11-23 下午 5:54
 * modify 2018-11-23 下午 5:54
 **/
@Service
//自动注入定时任务，并指定任务名称
@AutoScheduler(name = "IntegralScheduler", group = "Integral")
//使用@DisallowConcurrentExecution设置不并发执行
@DisallowConcurrentExecution
public class IntegralScheduler extends BaseScheduler {

    @Autowired
    private IntegralHandler integralHandler;

    public IntegralScheduler() {
        super(true);
    }

    @Override
    public String setDescription() {
        return "根据积分规则计算积分跑批任务";
    }

    @Override
    protected void executeInternal(JobExecutionContext context) {
        integralHandler.execute(); //计算积分任务预处理
    }

}